package com.dr.service.impl;

import com.dr.common.ution.StringUtil;
import com.dr.db.StudentMapper;
import com.dr.pojo.Student;
import com.dr.service.StudentInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by tugou on 2017/4/25.
 */
@Service
public class StudentInfoImpl implements StudentInfoService {

    @Autowired
    StudentMapper studentMapper;

    @Override
    public Student getStudent(String openId) {
        if (StringUtil.isNotEmpty(openId)){
            Student student = new Student();
            student.setOpenId(openId);
            return studentMapper.getStudent(student);
        }
        return null;
    }

    @Override
    public int saveStudent(Student student) {
        int result = studentMapper.insertStudent(student);
        return result;
    }
}
